package Z.dailyExercise._0225;

public class _867转置矩阵 {
    /**
     * 自解：借助栈实现 暴力遍历
     * @param matrix
     * @return
     */
    public int[][] transpose(int[][] matrix) {
        int m = matrix.length;
        int n = matrix[0].length;

        int[][] res= new int[n][m];

        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                res[j][i] = matrix[i][j];

            }

        }

        return res;

    }
}
